package com.yungu.swift.admin.route.order;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.model.PageVo;
import com.yungu.swift.base.model.admin.AdminUuidParam;
import com.yungu.swift.order.model.dto.OrderCallHistoryDto;
import com.yungu.swift.order.model.param.AdminCallOrderPageParam;
import com.yungu.swift.order.service.OrderCallHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : cuixiuyin
 * @date : 2019/7/17
 */
@Slf4j
@RestController
@RequestMapping("/admin/v1/order/join/call")
@Api(value = "【订单管理】", tags = "订单来电管理")
public class OrderCallAdmin {

    @Reference
    private OrderCallHistoryService orderCallHistoryService;

    @RequestMapping(value = "/queryPage", method = RequestMethod.POST)
    @ApiOperation(value = "分页查询来电订单", httpMethod = "POST")
    public ResponseData<PageVo<OrderCallHistoryDto>> callData(@RequestBody AdminCallOrderPageParam callOrderPageParam) {
        return orderCallHistoryService.queryPage(callOrderPageParam);
    }

    @RequestMapping(value = "close", method = RequestMethod.POST)
    @ApiOperation(value = "来电订单关闭", httpMethod = "POST")
    public ResponseData<Boolean> close(@RequestBody AdminUuidParam uuidParam) {
        return orderCallHistoryService.close(uuidParam.getUuid(), uuidParam.getUserUuid());
    }
}
